{% extends "common/panel.html" %}
{% block title %}{{title}}{% endblock %}

{% block panel %}

<script type="text/javascript" charset="utf-8">
    madrona.onShow(function(){
        madrona.setupForm($('#featureform'));
    });
</script>

{% if form.media %} {{ form.media }} {% endif %}

<h1>
    <img src="media/common/images/kml_document_icon.png"/>
    <small>New Uploaded KML</small> 
</h1>

<div class="box" style="padding-top:15px; padding-bottom:0px;">
    {% if form.is_multipart %}
    <form id="featureform" enctype="multipart/form-data" action="{{action}}" method="post">
        <input type='hidden' name='MAX_FILE_SIZE' value="10485760" /> <!-- 10 MB upload limit -->
    {% else %}
    <form id="featureform" action="{{action}}" method="post"> 
    {% endif %}
    {% if json %}
        <div style="display:none;" class="json">{{json}}</div>
    {% endif %}
    {% for field in form.visible_fields %}
        <div class="field{% if field.field.required %} required{% endif %}">
        {# Include the hidden fields in the form #}
        {% if forloop.first %}
        {% for hidden in form.hidden_fields %}
        <div style="display:none;">
            {{ hidden.errors }}
            {{ hidden }}
        </div>
        {% endfor %}
        {% endif %}

        {{ field.label_tag }}
        {{ field.errors }}
        {% if field.help_text %}
        <p class="help_text">
            {{ field.help_text|safe }}            
        </p>            
        {% endif %}
        {{ field }}            
    </div>
    {% endfor %}
    <p><input type="submit" value="submit"></p>
    </form>
</div>

<a href="#" class="cancel_button button red" onclick="this.blur(); return false;"><span>Cancel</span></a>
<a href="#" class="submit_button button" onclick="this.blur(); return false;"><span>Submit</span></a>
<br class="clear" />

{% endblock %}
